package day9;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/**
 * @author oldliu
 * @since 1.0
 */
public class FileOp {
    //有错误
    public static void main(String[] args) throws Exception {
        //为什么文件的内容被清空！
        File file = new File("D:\\Documents\\桌面\\chaoxian.txt");
        FileInputStream fin=new FileInputStream(file);
        FileOutputStream fout=new FileOutputStream(file);
        byte[]b=new byte[fin.available()];
        fin.read(b);
        for(int i=0;i<b.length;i++){
            b[i]=(byte)~b[i];
        }
        fout.write(b);
        fin.close();
        fout.close();
    }
}
